import abc
from abc import *
from network.networkutils import getDomain

class LoadEvent:
    source = None
    url = None
    domain = None

    def __init__(self, source, url):
        self.source = source
        self.url = url
        self.domain = getDomain(url)

    def getSource(self):
        return self.source

    def getURL(self):
        return self.url

    def getDomain(self):
        return self.domain

class NativePlugin:

    name = None
    pkgName = None
    version = 0.00

    def __init__(self, name, pkgName, version=0.00):
        self.name = name
        self.pkgName = pkgName
        self.version = version
        if name is not None and pkgName is not None and version > 0:
            self.onOK()


    @abstractmethod
    def onOK(self):
        pass

    @abstractmethod
    def loadEvent(self, event):
        pass

    @abstractmethod
    def loadStartEvent(self, event):
        pass

    @abstractmethod
    def loadProgress(self, event, amount):
        pass
